<?php

class cHtmlPage extends cUiPage
/**
  DESCRIPTION
	Responsible for displaying HTML pages to the client
**/
{
	public $sTitle;

	function __construct(){
		parent::__construct();
		header('Content-Type: text/xml');
		
		$this->AddStyle('base');
	}

	function DisplayHeader()
	/**
	  DESCRIPTION
	  	Outputs the XML header information
	**/
	{
		global $gDycmsVersion;

?>
<?xml version="1.0"?>

<XmlRoot>
<?php 	foreach($this->mzScripts as $id => $uri){
?><Script uri="<?php echo $uri; ?>" id="<?php echo $id; ?>" />
<?php 	}; // foreach
		foreach($this->mzStyles as $id => $uri){
?><Style uri="<?php echo $uri; ?>" id="<?php echo $id; ?>" />
<?php 	}; // foreach

?><StartupScript><?php echo(implode('\n', $this->mzStartScripts)); ?></StartupScript><?php
	}

	function DisplayFooter()
	/**
	  DESCRIPTION
	  	Closes the XML document
	**/
	{
?>
</XmlRoot>
<?php
	}

	function AddHtmlHeader($s) {
		// Discarded
	}
}

class cDefaultContentNode extends cDycmsClientNode
{
    function DisplayHeader(){
        echo '<ContentNode>';
    }
    function DisplayFooter(){
        echo '</ContentNode>';
    }
}

class cHtmlTemplate extends cDycmsClientNode
{
	protected $msName;

	function __construct($s_name)
	{
		//if(!ctype_alnum($name))
		//	throw EINVALIDARGS;

		$this->msName = "tpl-".$s_name.".php";
	}

	function DisplayBody()
	{
		global $gLocale;

		if(($fp = @fopen('ui/'.$this->msName, 'r', 1)) and fclose($fp))
		{
			echo '<![CDATA[';
			include('ui/'.$this->msName);
			echo ']]>';
		}
		else
		{
			//include("ui/$gLocale/sys-ui-msgnotfound.php");
			//echo("uiTemplate: $this->msName, Locale: $gLocale");
		};
	}
}

class cUiPageHeader extends cHtmlWrapper
{
	protected $msInnerHtml;

	function __construct($innerHtml = '')
	{
		parent::__construct('<div class="page-header">', "</div>");

		$this->msInnerHtml = $innerHtml;
	}

	function DisplayBody()
	{
		echo $this->msInnerHtml;
	}
}

class cUiPageBody extends cHtmlWrapper
{
	protected $msInnerHtml;

	function __construct()
	{
		parent::__construct('<div class="page-body">', "</div>");
	}
}

?>
